﻿using System;
using Microsoft.SPOT;
using Microsoft.SPOT.Presentation;
using Microsoft.SPOT.Presentation.Controls;
using Microsoft.SPOT.Presentation.Media;

using GT = Gadgeteer;
using GTM = Gadgeteer.Modules;

using Gadgeteer.Modules.Seeed;

namespace TemperatureHumidityTestApp
{
    public partial class Program
    {

        TemperatureHumidity tempHumidSensor = new TemperatureHumidity(11);

        void ProgramStarted()
        {
            /******************************************************************************************
            Access modules defined in the designer by typing their name:                            
            
            e.g.  button
                  camera1

            Initialize event handlers here.
            e.g. button.ButtonPressed += new GTM.MSR.Button.ButtonEventHandler(button_ButtonPressed);             
            ***************************************************************************************** */

            tempHumidSensor.MeasurementComplete += new TemperatureHumidity.MeasurementCompleteEventHandler(tempHumidSensor_MeasurementComplete);

            tempHumidSensor.StartContinuousMeasurements();

            // Do one-time tasks here
            Debug.Print("Program Started");
        }

        void tempHumidSensor_MeasurementComplete(TemperatureHumidity sender, double temperature, double relativeHumidity)
        {
            Debug.Print("Temperature: " + temperature + " Humidity: " + relativeHumidity); 
        }
    }
}
